package com.demo.zhou.sniper.adapter;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.demo.zhou.sniper.R;
import com.demo.zhou.sniper.module.ColorTable;


public class HorizonListviewAdapter extends BaseAdapter {

	private LayoutInflater inflater = null;
	List<String> tables = new ArrayList();

	public HorizonListviewAdapter(Context context, List<String> tables) {
		this.inflater = LayoutInflater.from(context);
		this.tables = tables;
	}

	@Override
	public int getCount() {
		return tables.size();
	}

	@Override
	public Object getItem(int position) {
		return tables.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder = null;
		if (convertView == null) {
			holder = new ViewHolder();
			convertView = inflater.inflate(R.layout.item_history_bill_single, null);
			holder.ct_conten = (TextView) convertView.findViewById(R.id.tv_history_bill_date);
			convertView.setTag(holder);
		}else {
			holder = (ViewHolder) convertView.getTag();
		}
		holder.ct_conten.setText(position+1+"");
		if (getItem(position).equals("d")){
			convertView.setBackgroundColor(Color.parseColor("#FF0000"));
		}else {
			convertView.setBackgroundColor(Color.parseColor("#0000FF"));
		}
		return convertView;
	}

	class ViewHolder {
		TextView ct_conten;

	}
	
}
